<template>
  <div class="page login-page">
      <div class="container d-flex align-items-center">
        <div class="form-holder has-shadow">
          <div class="row">
            <!-- Logo & Information Panel-->
            <div class="col-lg-6">
              <div class="info d-flex align-items-center">
                <div class="content">
                  <div class="logo">
                    <h1>欢迎登录</h1>
                  </div>
                  <p>金屹电源远程管理系统</p>
                </div>
              </div>
            </div>
            <!-- Form Panel    -->
            <div class="col-lg-6 bg-white">
              <div class="form d-flex align-items-center">
                <div class="content">
                  <form action="1" class="form-validate" id="loginFrom">
                    <div class="form-group">
                      <input id="login-username" type="text" name="username" required data-msg="请输入用户名" placeholder="用户名" v-model="username" class="input-material">
                    </div>
                    <div class="form-group">
                      <input id="login-password" type="password" name="passWord" v-model="password" required data-msg="请输入密码" placeholder="密码" class="input-material">
                    </div>
                    <el-button id="login" type="primary" round @click="login"  class="btn btn-primary">主要按钮</el-button>
                    <div style="margin-top: -40px;"> 
                    	<!-- <input type="checkbox"  id="check1"/>&nbsp;<span>记住密码</span>
                    	<input type="checkbox" id="check2"/>&nbsp;<span>自动登录</span> -->
                    	<div class="custom-control custom-checkbox " style="float: right;">
											    <input type="checkbox" class="custom-control-input" id="check2" >
											    <label class="custom-control-label" for="check2">自动登录</label>
											</div>
											<div class="custom-control custom-checkbox " style="float: right;">
											    <input type="checkbox" class="custom-control-input" id="check1" >
											    <label class="custom-control-label" for="check1">记住密码&nbsp;&nbsp;</label>
											</div> 
                    </div>
                  </form>
                  <br />
                  <small>没有账号?</small><a href="register.html" class="signup">&nbsp;注册</a>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
</template>

<script>
export default {
   data() {
      return {
        username:"admin",password:"",
      }; 
    },
   methods:{
    login(){
      let url="/login";
      let params={username:this.username,password:this.password};
      this.$axios.post(url,params).then(resp=>{if(resp.data){console.log(resp.data);window.sessionStorage.setItem('Authorization',JSON.stringify(resp.data.result));
                        this.$router.push('/index');}else{console.log("登录失败")};}).catch(ex=>{});
    }
  }
}
</script>